

#ifndef FLASHM_H
#define FLASHM_H

#include <xc.h>
#include "types.h"

#define _FB(FLASH_ADDRESS)	  *(UINT8 volatile *)(FLASH_ADDRESS)
#define _FI(FLASH_ADDRESS)	  *(INT16 volatile *)(FLASH_ADDRESS)
#define _FW(FLASH_ADDRESS)	  *(UINT16 volatile *)(FLASH_ADDRESS)
#define _FL(FLASH_ADDRESS)	  *(INT32 volatile *)(FLASH_ADDRESS)
#define _FS(FLASH_ADDRESS)	  *(UINT32 volatile *)(FLASH_ADDRESS)

#define    sTest        _FW(0x400)

void FlashM_Erase(UINT32 startAddr);
void FlashM_Read16(UINT32 startAddr, UINT8 *dataHi, UINT8 *dataLo);
void FlashM_Write16(const UINT32 startAddr, const UINT16 dataNew);
void FlashM_Write64(UINT32 startAddr, UINT16 *dataNew);
BOOL Flash_HandleWrite16(const UINT32 startAddr, const UINT16 dataNew);


#endif